﻿using System;
using System.Windows.Controls;
using BlockMix.Utilities;

namespace BlockMix.Controls
{
    /// <summary>
    /// Interaction logic for Block.xaml
    /// </summary>
    public partial class Block : UserControl
    {

        public Block()
        {
            InitializeComponent();
        }

        #region Properies

        public double Top
        {
            get
            {
                if (double.IsNaN(Canvas.GetTop(this)))
                {
                    return (double)0;
                }
                return Canvas.GetTop(this);
            }
            set
            {
                Canvas.SetTop(this, value);
            }
        }

        public double Left
        {
            get
            {
                if (double.IsNaN(Canvas.GetLeft(this)))
                {
                    return (double)0;
                }
                return Canvas.GetLeft(this);
            }
            set
            {
                Canvas.SetLeft(this, value);
            }
        }

        #endregion

        #region Event Handlers

        private void Block_Initialized(object sender, EventArgs e)
        {
            block.Width = AppContext.BlockSize.Width;
            block.Height = AppContext.BlockSize.Height;
        }

        #endregion
    }
}
